package com.zhbcm.netty.client;

import com.zhbcm.netty.po.RpcRequest;
import io.netty.channel.Channel;

import java.util.UUID;

/**
 * @author 朝花不迟暮
 * @version 1.0
 * @date 2021/4/22 23:08
 */
public class ClientMain
{
    public static void main(String[] args) throws InterruptedException
    {
        NettyClient client = new NettyClient("192.168.0.108", 8080);
        //启动client服务
        client.start();

        Channel channel = client.getChannel();
        //消息体
        RpcRequest request = new RpcRequest();
        request.setId(UUID.randomUUID().toString());
        request.setData("client.message");
        //channel对象可保存在map中，供其它地方发送消息
        channel.writeAndFlush(request);
    }
}
